package com.iplatform.commons.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;


/**
 * @Author: MrRed
 * @CreateDate: 2020-04-14
 * @Description: 通用http请求返回dto
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "com.iplatform.commons.utils", description = "通用http请求返回")
public class CommResponse<T> {
	/**
	 * 请求返回信息
	 **/
	@ApiModelProperty(value = "请求返回信息")
	private String msg;
	
	/**
	 * 请求返回结果（布尔）
	 **/
	@ApiModelProperty(value = "请求返回结果（布尔）")
	private Boolean res;
	
	
	/**
	 * 请求返回结果对象
	 **/
	@ApiModelProperty(value = "请求返回结果对象")
	private T result;
	
	/**
	 * 请求返回结果对象
	 **/
	@ApiModelProperty(value = "请求返回结果对象（List）")
	private List<T> results;
	
	public CommResponse(String msg, Boolean res) {
		this.msg = msg;
		this.res = res;
	}
	
	public CommResponse(String msg, Boolean res, T result) {
		this.msg = msg;
		this.res = res;
		this.result = result;
	}
	
	public CommResponse(String msg, Boolean res, List<T> results) {
		this.msg = msg;
		this.res = res;
		this.results = results;
	}
	
	
}
